# -*- coding: utf-8 -*-
# __author__ = 'xxx'
# env: py 3.6 + requests-2.28.2
# fuction: 构造请求

import  urllib.parse

# 拼接 url
# https://www.xxx.com/s?ie=utf-8&wd=show
baseurl='https://www.xxx.com/s'

queryuse={
    'wd':"python 学习 在线 ",
    'ie':"UTF-8"
}

# 编码 URL
getuseurl=baseurl+"?"+urllib.parse.urlencode(queryuse)
print(f"构建 URL 地址是： {getuseurl}")


#解码 URL
getuencode=urllib.parse.unquote(getuseurl)
print(f"解码 URL 是：{getuencode}")




